package graphics.rendering;

import graphics.GraphicsManager;

import org.lwjgl.opengl.GL11;
import org.lwjgl.util.glu.GLU;

public class CorePipeline extends GraphicsPipeline {
	
	public CorePipeline(GraphicsManager manager) {
		super(manager);
	}

	@Override
	public void processPrimitives() {
		GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
		
		GL11.glLoadIdentity();
		GL11.glBegin(GL11.GL_QUADS);
			GL11.glColor3f(0.2f, 0.4f, 0.0f);
			GL11.glVertex3f(-100.0f, -1.0f, 100.0f);
			GL11.glVertex3f(-100.0f, -1.0f, -100.0f);
			GL11.glVertex3f(100.0f, -1.0f, -100.0f);
			GL11.glVertex3f(100.0f, -1.0f, 100.0f);
		GL11.glEnd();
	}
	
	@Override
	public void setup() {
		GL11.glViewport(0, 0, manager.getWidth(), manager.getHeight());
		GL11.glMatrixMode(GL11.GL_PROJECTION);
		GL11.glLoadIdentity();
		GLU.gluPerspective(45.0f, ((float)manager.getWidth()/(float)manager.getHeight()), 0.1f, 100.0f);
		GL11.glMatrixMode(GL11.GL_MODELVIEW);
		GL11.glLoadIdentity();
		GL11.glShadeModel(GL11.GL_SMOOTH);
		GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
		GL11.glClearDepth(1.0f);
		GL11.glEnable(GL11.GL_DEPTH_TEST);
		GL11.glDepthFunc(GL11.GL_LEQUAL);
		GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);
	}

	@Override
	public void shutdown() {
		// TODO Auto-generated method stub

	}

}
